Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


USBFindNextInterfaceDescriptorImmediate

The USBFindNextInterfaceDescriptorImmediate function returns the address to the next interface descriptor in a specified configuration descriptor.

OSStatus USBFindNextInterfaceDescriptorImmediate(USBPB *pb)

Required fields in the USBPB parameter block for the USBFindNextInterfaceDescriptorImmediate function are

--> pbLength
Length of parameter block
--> pbVersion
Parameter block version number
--> usbCompletion
The completion routine
--> usbRefcon
General-purpose value passed back to the completion routine

<--> usbBuffer
--> Configuration descriptor
<-- Interface descriptor
--> usbFlags
Should be set to 0

<-- usbActcount
Length of interface descriptor found

<--> usbReqCount
--> 0, This should be set to 0 the first time the call is made. Otherwise, the value from the last call should be left alone.
<-- Offset of this descriptor from the start of the configuration descriptor

<--> usbClassType
--> Class; 0 matches any class
<-- Class value for interface found

<--> usbSubclass
--> Subclass; 0 matches any subclass
<-- Subclass value for interface found

<--> usbProtocol
--> Protocol; 0 matches any protocol
<-- Protocol value for interface found

<--> usb.cntl.WValue
--> 0 Configuration number: If more than one interface is described in the configuration descriptor, this field specifies the absolute number of the interface in the list.

<-- usb.cntl.WIndex
Interface number

<-- usbOther
Alternate interface

The usbReqCount field should be set to 0 for the first iteration of this call. For each subsequent call to the USBFindNextInterfaceDescriptorImmediate function, usbReqCount contains the offset of the current interface descriptor from the beginning of the configuration descriptor.

The usbBuffer field should be assigned the address of the start of the configuration descriptor obtained from a call to the USBGetFullConfigurationDescriptor function. This must be the full configuration descriptor returned by USBGetFullConfigurationDescriptor . The usbBuffer is assigned a pointer to the next interface descriptor within the specified configuration for each subsequent call to the USBFindNextInterfaceDescriptorImmediate function.

The usbClass , usbSubclass , and usbProtocol fields should contain either specific class, subclass, and protocol numbers, or contain 0 to use for a wildcard search if the caller wants to find an interface regardless of these fields. Upon return, these fields contain the class, subclass, and protocol values for the next interface found. If the caller wants to perform a wildcard search again, the wildcard values must be reset, because these fields are filled in with the returned values from the last call.

Once you've found an interface in the device, you need to find the endpoints that make up that interface.

If no interface is found that matches the requested interface, kUSBNotFound is returned.

The errors returned by the USBFindNextInterfaceDescriptorImmediate function include:

kUSBNotFound
interface specified is not in configuration
kUSBInternalErr, paramErr
not a valid configuration descriptor

© 1999 Apple Computer, Inc.

Previous | Back Up One Level | Next | Show Frames | Hide Frames